import gui.App;

import java.sql.SQLException;
import java.util.Date;

import models.Client;
import models.Payment;
import models.Subscription;
import models.Workshop;
import models.Workshop.DagDeel;
import database.DummySQLServer;
import database.SQLServer;
import databasetranslation.ClientList;
import databasetranslation.DatabaseLists;
import databasetranslation.PaymentList;
import databasetranslation.SubscriptionList;
import databasetranslation.WorkshopList;

public class NotConnectedCCO {
	@SuppressWarnings("deprecation")
	public static void main(String [] args) {		
		try {
			SQLServer server = new DummySQLServer();
			DatabaseLists dbLists = new DatabaseLists(server);
			
			ClientList clients = dbLists.getClientList();
			Client c1 = new Client("Bart", "Spencer", "Myroad 16, 28240 MyCity", "06 390 2432 34", "markspancer@gmail.com");
			Client c2 = new Client("Achiel", "flap", "Myop 16, 28240 youCity", "06 974 452 34", "flipflap@gmail.com");
			Client c3 = new Client("Camiel", "flup", "Mioup 16, 2854 flapCity", "06 853 322 34", "flopflup@gmail.com");
			
			clients.add(c1);		
			clients.add(c2);
			clients.add(c3);
			
			WorkshopList workshops = dbLists.getWorkshopList();
			Date now = new Date();
			Date coming1 = new Date();
			coming1.setYear(now.getYear() + 1);
			Date coming2 = new Date();
			coming2.setYear(now.getYear() + 2);
			DagDeel vm1 = DagDeel.VOORMIDDAG;
			DagDeel vm2 = DagDeel.NAMIDDAG;
			Workshop w1 = new Workshop("Alles maken", now, vm1, 10.0, "explanation1", 10, "docent1");
			Workshop w2 = new Workshop("Canon zingen", coming1, vm1, 12.0, "explanation2", 100, "docent2");
			Workshop w3 = new Workshop("Bloemschikken", coming2, vm2, 15.0, "explanation3 die heel lang is en heel langdradig netzo als de workshop bloemschikken want die is ontzettend saai en bloemen stinken vreselijk. raad iedereen aan om de workshop alles maken te volgen want die is veel leuker dan deze. END", 150, "docent3");
			Workshop w4 = new Workshop("Weinig plaats", coming1, vm1, 12.0, "explanation4", 1, "docent1");
			
			workshops.add(w1);
			workshops.add(w2);
			workshops.add(w3);
			workshops.add(w4);
			
			SubscriptionList subscriptions = dbLists.getSubscriptionList();
			subscriptions.add(new Subscription(c1,w1));
			subscriptions.add(new Subscription(c1,w2));
			subscriptions.add(new Subscription(c2,w2));
			subscriptions.add(new Subscription(c3,w1));
			subscriptions.add(new Subscription(c3,w2));
			subscriptions.add(new Subscription(c3,w3));
			
			PaymentList payments = dbLists.getPaymentList();
			payments.add(new Payment(c1, 22, now, "I've made a comment."));
			payments.add(new Payment(c2, 100, now, "I've made no comment."));
			
			new App(dbLists, false);
			
		} catch (SQLException e) {
			// Is not connected to server, will never generate an SQLException.
			e.printStackTrace();
		}
		
	}
}
